package com.walkline.weibo.inf;

import org.json.me.JSONArray;
import org.json.me.JSONObject;
import com.walkline.util.StringUtility;

public class PictureUrls
{
	private String[] _thumbnail_urls = null;
	private String[] _square_urls = null;
	private String[] _bmiddle_urls = null;
	private String[] _original_urls = null;
	private int _count = 0;

	public PictureUrls(JSONArray jsonArray)
	{
		if (jsonArray.toString().equals("[]")) {return;}

		JSONObject jsonobject;
		int count = jsonArray.length();

		_count = count;
		_thumbnail_urls = new String[count];
		_square_urls = new String[count];
		_bmiddle_urls = new String[count];
		_original_urls = new String[count];

		for (int i=0; i<count; i++)
		{
			jsonobject = jsonArray.optJSONObject(i);

			_thumbnail_urls[i] = jsonobject.optString("thumbnail_pic");
			_square_urls[i] = StringUtility.replace(_thumbnail_urls[i], "thumbnail", "square");
			_bmiddle_urls[i] = StringUtility.replace(_thumbnail_urls[i], "thumbnail", "bmiddle");
			_original_urls[i] = StringUtility.replace(_thumbnail_urls[i], "thumbail", "large");
		}
	}

	public int getCount() {return _count;}

	public String[] getThumbnailPics() {return _thumbnail_urls;}

	public String[] getSquarePics() {return _square_urls;}

	public String[] getMiddlePics() {return _bmiddle_urls;}

	public String[] getOriginalPics() {return _original_urls;}
}